package com.stu.management.service.impl;


import com.stu.management.mapper.MiddleMapper;
import com.stu.management.pojo.Middle;
import com.stu.management.pojo.MiddleExample;
import com.stu.management.service.MiddleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class MiddleServiceImpl implements MiddleService {

    @Autowired
    private MiddleMapper middleDao;

    @Override
    public ArrayList<Integer> queryMiddleById(int roleid) {
        MiddleExample middleExample = new MiddleExample();
        middleExample.createCriteria().andRoleidEqualTo(roleid);
        List<Middle> middles = middleDao.selectByExample(middleExample);
        ArrayList<Integer> mid = new ArrayList<>();
        middles.forEach((c)->mid.add(c.getMenuid()));
        return mid;
    }
}
